<template>
	<view class="uni-popup-share">
		<view class="uni-share-title"><text class="uni-share-title-text">{{title}}</text></view>
		<u-icon name="close" class="icon" @click="close"></u-icon>
		<view class="uni-share-content">
			<view class="uni-share-content-box">
				<button :plain="true" class="uni-share-content-item" v-for="(item,index) in bottomData" :key="index" @click.stop="select(item,index)" open-type="share">
					<image class="uni-share-image" :src="item.icon" mode="aspectFill"></image>
					<text class="uni-share-text">{{item.text}}</text>
				</button>

			</view>
		</view>
	<!-- 	<view class="uni-share-button-box">
			<button class="uni-share-button" @click="close">取消</button>
		</view> -->
	</view>
</template>

<script>
	import share1 from '../../static/talent/home/share1.png'
	import share2 from '../../static/talent/home/share2.png'
	export default {
		
		name: 'UniPopupShare',
		props: {
			title: {
				type: String,
				default: '分享到'
			}
		},
		inject: ['popup'],
		data() {
			return {
				bottomData: [{
						text: '微信好友',
						icon: share2,
						name: 'wx'
					},
					{
						text: '朋友圈',
						icon: share1,
						name: 'wx'
					}
				]
			}
		},
		created() {},
		methods: {
			/**
			 * 选择内容
			 */
			select(item, index) {
				this.$emit('select', {
					item,
					index
				}, () => {
					this.popup.close()
				})
			},
			/**
			 * 关闭窗口
			 */
			close() {
				this.popup.close()
			}
		}
	}
</script>
<style lang="scss" scoped>
	.uni-popup-share {
		background-color: #fff;
		position: relative;
		border-radius: 24rpx 24rpx 0 0;
	}
	.icon {
		position: absolute;
		top: 25upx;
		right: 30upx;
	}
	.uni-share-title {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		align-items: center;
		justify-content: center;
		height: 40px;
	}
	.uni-share-title-text {
		font-size: 32upx;
		color: #333;
		font-weight: 700;
	}
	.uni-share-content {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		justify-content: center;
		padding-top: 10px;
		padding-bottom: 20px;
	}
	
	.uni-share-content-box {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		flex-wrap: wrap;
		width: 360px;
	}
	
	.uni-share-content-item {
		width: 90px;
		/* #ifndef APP-NVUE */
		display: flex;
		flex: 3.3;
		/* #endif */
		flex-direction: column;
		justify-content: center;
		padding: 10px 0;
		align-items: center;
		outline: none !important;
		background: #FFFFFF;
		border: 1px solid transparent !important;
	}
	
	.uni-share-content-item:active {
		background-color: #f5f5f5;
	}
	
	.uni-share-image {
		width: 45px;
		height: 45px;
	}
	
	.uni-share-text {
		margin-top: 10px;
		font-size: 14px;
		color: #3B4144;
	}
	
	.uni-share-button-box {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		padding: 10px 15px;
	}
	
	.uni-share-button {
		flex: 1;
		border-radius: 50px;
		color: #666;
		font-size: 16px;
	}
	
	.uni-share-button::after {
		border-radius: 50px;
	}
</style>
